package com.treeroot.orderservice.order.client.DegradeFeignClient;

import com.treeroot.commonutils.exceptionhandler.MyException;
import com.treeroot.commonutils.ordervo.UserInfoOrder;
import com.treeroot.orderservice.order.client.UserClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: 接口中的泛型为要对其进行错误处理的接口
 * @Author:treeRoot
 * @Email:553503639@qq.com
 * @Date: Create in 13:58 / 2022/6/7
 */
@Component
public class getUserInfoDegradeFeignClient implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable cause) {
        return new UserClient() {
            @Override
            public UserInfoOrder getUserInfoOrder(String id) {
                System.out.println("获取用户基本信息出错");
                return null;
            }

        };


    }
}
